import { defineStore } from "pinia";
export const useMainStore = defineStore("main", {
  state: () => {
    return {
      cachedViews: [],
    };
  },
  actions: {
    addCacheView(payload: any) {
      const path = payload.path as never;
      if (!this.cachedViews.includes(path)) {
        this.cachedViews.push(path);
      }
    },
    deleteCacheView(payload: any) {
      this.cachedViews = this.cachedViews.filter(
        (item) => item != payload.path
      );
    },
  },
});
